<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div class="modal-dialog">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
			<h3 id="myModalLabel">${empty entity?'新增':'修改' }app信息</h3>
		</div>
		<div class="modal-body">
			<form class="form-horizontal" method="post" id="sysUserForm" name="appversionForm"
				action="appversion/save${empty entity?'Insert':'Update' }.htm"
				role="form">
				<div class="form-group">
					<label class="col-sm-2 control-label">APP类型<font
						color="red">&nbsp;*</font></label>
					<div class="col-sm-10">
						<input type="hidden" value="${entity.appVersionId }" name="app_type" /> 
						
						<label class="checkbox-inline"> 
							<input type="radio" name="appType" id="app_type" value="1" ${entity.appType=='1'?'checked':'' }> ios
						</label> 
						
						<label class="checkbox-inline"> 
							<input type="radio" name="appType" id="app_type" value="0" ${entity.appType=='0'?'checked':'' }>
							android
						</label> 
						
						<label class="checkbox-inline"> 
							<input type="radio" name="appType" id="app_type" value="2" ${entity.appType=='2'?'checked':'' }>
							wp
						</label>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label">是否强制更新<font color="red">&nbsp;*</font></label>
					<div class="col-sm-10">
						<input type="hidden" value="${entity.appVersionId }" name="forced_update" />
						 <label class="checkbox-inline"> <input type="radio" name="forcedUpdate" id="forced_update" value="0" ${entity.forcedUpdate=='1'?'checked':'' }> 
						 	常规更新
						</label> 
						<label class="checkbox-inline"> <input type="radio" name="forcedUpdate" id="forced_update" value="1" ${entity.forcedUpdate=='1'?'checked':'' }>
						 	强制更新
						</label>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label">状态<font color="red">&nbsp;*</font></label>
					<div class="col-sm-10">
						<label class="checkbox-inline"> <input type="radio"
							name="state" id="state" value="1" ${entity.state=='1'?'checked':'' }>
							有效
						</label> <label class="checkbox-inline"> <input type="radio"
							name="state" id="state" value="2" ${entity.state=='2'?'checked':'' }>
							失效
						</label><label class="checkbox-inline"> <input type="radio"
							name="state" id="state" value="9" ${entity.state=='9'?'checked':'' }>
							已删除
						</label>
					</div>
				</div>

				<div class="form-group">
					<label class="col-sm-2 control-label">版本标签<font color="red">&nbsp;*</font></label>
					<div class="col-sm-10">
						<label class="checkbox-inline"> <input type="radio"
							name="tag" id="tag" value="1" ${entity.state=='1'?'checked':'' }>
							生产
						</label> <label class="checkbox-inline"> <input type="radio"
							name="tag" id="tag" value="2" ${entity.state=='2'?'checked':'' }>
							预发布
						</label><label class="checkbox-inline"> <input type="radio"
							name="tag" id="tag" value="9" ${entity.state=='9'?'checked':'' }>
							测试
						</label>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label">更新描述<font color="red">&nbsp;*</font></label>
					<div class="col-sm-10">
						<input type="text" class="form-control" name="changeDesc"
							id="change_desc" value="${entity.changeDesc }">
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label">URL</label>
					<div class="col-sm-10">
						<input type="text" class="form-control" name="downloadUrl"
							id="download_url" value="${entity.downloadUrl }">
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label">版本号</label>
					<div class="col-sm-10">
						<input type="text" class="form-control" name="versionNumber"
							id="version_number" value="${entity.tag }">
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label">备注</label>
					<div class="col-sm-10">
						<input type="text" class="form-control" name="remark"
							id="remark" value="${entity.remark }">
					</div>
				</div>
				
				<span id="tip"
					style="color: red; font-size: 14px; margin-left: 20px;"></span>
			</form>
		</div>
		<div class="modal-footer">
			<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">取消</button>
			<button class="btn btn-primary" data-dismiss="modal">保存</button>
		</div>
	</div>
</div>

<script type="text/javascript" src="resources/js/My97DatePicker/WdatePicker.js" charset="utf-8"></script>

<script type="text/javascript">
	function check_fun() {
		$("#tip").html("");
		var b = true;
		
		var appType = $('input[name="appType"]:checked').val();
		
		var forcedUpdate = $('input[name="forcedUpdate"]:checked').val();
		
		var state = $('input[name="state"]:checked').val();
		
		var tag = $('input[name="tag"]:checked').val();
		
		var changeDesc = $("#change_desc").val();
		
		if (appType == null || appType.trim() == '') {
			$("#tip").html("APP类型必选项");
			b = false;
		}		
		
		if (forcedUpdate == null || forcedUpdate.trim() == '') {
			$("#tip").html("是否强制更新必选项");
			b = false;
		}	
		
		if (state == null || state.trim() == '') {
			$("#tip").html("请选择状态");
			b = false;
		}	
		
		if (tag == null || tag.trim() == '') {
			$("#tip").html("版本标签请选择");
			b = false;
		}
		
		if (changeDesc == null || changeDesc.trim() == '') {
			$("#tip").html("更新描述不能为空");
			b = false;
		}
		
		return b;
	}

</script>
